import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Cut {

	public int getMaximum(int[] eelLengths, int maxCuts) {
		//Arrays.sort(eelLengths);
		int res = 0;
		
		for (int x=10; x<=1000; x+=10) {
			for (int i=0; i<eelLengths.length; i++) {		
				if (eelLengths[i] == x && maxCuts >= x/10 - 1) {
					maxCuts -= x/10 - 1;
					res += x/10;
					eelLengths[i] = 0;
				}
			}
		}
		
		for (int i=0; i<eelLengths.length; i++) {			
			if (eelLengths[i] > 0) {
				res += Math.min(eelLengths[i] / 10, maxCuts);
				maxCuts -= Math.min(eelLengths[i] / 10, maxCuts);
			}
		}
		
		return res;
	}

}
